package org.wuliu.Controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.wuliu.dao.QvpaidanDao;
import org.wuliu.pojo.Qvpaidan;
import org.wuliu.utils.ResponseResult;

import java.util.List;

@Controller
@RequestMapping("/qvpaidian")
@CrossOrigin(value = "*")
public class QvpaidianController {
    @Autowired
    private QvpaidanDao qvpaidanDao;
    @RequestMapping("/add")
    @ResponseBody
    public ResponseResult add(Qvpaidan qvpaidan){
        qvpaidanDao.add(qvpaidan);
        return ResponseResult.createSuccessResUle();
    }
    @RequestMapping("/show")
    @ResponseBody
    public ResponseResult show(){
        List<Qvpaidan> list=qvpaidanDao.getAll();
        return new ResponseResult(list);
    }
}
